package spark.graphics;

import spark.graphics.Texture;
import spark.math.Vector2;
import spark.exception.LoadingException;
import spark.identity.IReleaseable;
import spark.identity.IIdentifiable;

public class Sprite implements IReleaseable {
	private Texture texture;
	//UV Coordinates on the texture, the left top corner is 0.0 while the bottom right corner is 1,1
	private Vector2 uvCoordinates;
	//Dimensions of the sprite on the texture
	private Vector2 dimensions;
	private boolean opaque = true;

	public Sprite(Texture texture, boolean opaque) {
		this.opaque = opaque;
		this.texture = texture;
		this.uvCoordinates = new Vector2(0,0);
		this.dimensions = new Vector2(1,1);
	}

	public Sprite(Texture texture, boolean opaque, Vector2 uvCoordinates, Vector2 dimensions) {
		this(texture, opaque);
		this.uvCoordinates = uvCoordinates;
		this.dimensions = dimensions;
	}

	public Texture getTexture() {
		return texture;
	}

	public Vector2 getUvCoordinates() {
		return uvCoordinates;
	}

	public Vector2 getDimensions() {
		return dimensions;
	}

	@Override
	public void release() {
		texture.release();
	}

	public boolean isOpaque() {
		return opaque;
	}
}
